listen=YES
listen_port={{ vsftpd_listen_port }}
ftp_data_port={{ vsftpd_data_port }}
connect_from_port_20=YES
use_localtime=YES
dirmessage_enable=YES
xferlog_enable=YES
xferlog_std_format=YES
xferlog_file={{ vsftpd_xferlog_file }}
dual_log_enable=YES
vsftpd_log_file={{ vsftpd_log_file }}
syslog_enable={{ 'YES' if vsftpd_syslog_enable else 'NO' }}

local_umask={{ vsftpd_local_umask | default('022')}}
{% if not vsftpd_vusers %}
pam_service_name=vsftpd
{% endif %}
write_enable=YES
userlist_enable=YES
tcp_wrappers=YES

pasv_min_port={{ vsftpd_pasv_min_port | default('30000') }}
pasv_max_port={{ vsftpd_pasv_max_port | default('31000') }}

ftpd_banner={{ vsftpd_banner | default('Welcome to Ftp Server!') }}

{% if vsftpd_anon and not vsftpd_local_users and not vsftpd_vusers %}
local_enable=NO
anonymous_enable=YES
no_anon_password=YES
anon_root={{ vsftpd_share_path | default('ftp_share') }}
anon_upload_enable=YES
anon_world_readable_only=NO
anon_other_write_enable=YES
anon_mkdir_write_enable=YES
anon_umask=022
{% elif vsftpd_local_users and not vsftpd_vusers %}
anonymous_enable=NO
local_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
{% elif vsftpd_vusers %}
guest_username=ftp
anonymous_enable=NO
local_enable=YES
guest_enable=YES
virtual_use_local_privs=YES
allow_writeable_chroot=YES
chroot_local_user=YES
chroot_list_enable=NO
pam_service_name=vsftpd.vu
local_root={{ vsftpd_share_path }}
user_config_dir={{ vsftpd_userconf }}
{% endif %}

{% if vsftpd_options %}
{{ vsftpd_options }}
{% endif %}
